<?php
    $conn = new mysqli('localhost', 'root', 'root', 'sanxing');

    if ($conn -> connect_error) {
        die('登录失败');
    }

    // 接收前端的参数
   /*  $num =1;
    $limit =9;

    // 3
    $start = ($num - 1) * $limit; */

    $sql1 = "SELECT * FROM `xiangqing` LIMIT 1, 9";

    $res1 = $conn -> query($sql1);

    $arr1 = array();

    while ($row1 = mysqli_fetch_assoc($res1)) {
        array_push($arr1, $row1);
    }


    $sql2 = "SELECT * FROM `xiangqing` LIMIT 10, 9";

    $res2 = $conn -> query($sql2);

    $arr2 = array();

    while ($row2 = mysqli_fetch_assoc($res2)) {
        array_push($arr2, $row2);
    }



    $sql3 = "SELECT * FROM `xiangqing` LIMIT 19, 9";

    $res3 = $conn -> query($sql3);

    $arr3 = array();

    while ($row3 = mysqli_fetch_assoc($res3)) {
        array_push($arr3, $row3);
    }



    $sql4 = "SELECT * FROM `xiangqing` LIMIT 28, 9";

    $res4 = $conn -> query($sql4);

    $arr4 = array();

    while ($row4 = mysqli_fetch_assoc($res4)) {
        array_push($arr4, $row4);
    }



    echo json_encode(array(
        'state' => true,
        'data1' => $arr1,
        'data2' => $arr2,
        'data3' => $arr3,
        'data4' => $arr4,
        
    ));
?>